<?php
/**
 * 用户管理
 *
 */

/*
 * remove user
 * 删除用户
 */
if(($_GET['todo'] == 'del') && $_GET['id']) {
	$_GET['id'] = (int)$_GET['id'];
	$user = $db->rows('SELECT username FROM admin_users WHERE id="'.$_GET['id'].'"');
	if(($user['username'] != 'admin') && $user['username']) {
		$sql = 'DELETE FROM admin_users WHERE id="'.$_GET['id'].'"';
		if($db->query($sql)) {
			Basic::flash($tpl->lang('Finished!'));
			$menu->removeMenu($user['username']);
		} else {
			Basic::flash($tpl->lang('Failed!'));
		}
		header('location: ?model=admin&action=users');
	}
}

$sql =  'SELECT * FROM admin_users';
$rsUsers = $db->query($sql);


Basic :: setModelFile('head');
Basic :: setModelFile('users');
Basic :: setModelFile('bottom');
$tpl->p('users');

?>